updating oE load_map

load_map

include map.e 
namespace map 
public function load_map(object file_name_p) 

loads a map from a file.

Parameters:
  1. file_name_p : The file to load from. This file may have been created by the save_map function. This can either be a name of a file or an already opened file handle.
Returns:

Either a map, with all the entries found in file_name_p, or -1 if the file failed to open, or -2 if the file is incorrectly formatted.

Comments:

If file_name_p is an already opened file handle, this routine will read from that file and not close it. Otherwise, the named file will be opened and closed by this routine.

The input file can be either one created by the save_map function or a manually created or edited text file. See save_map for details about the required layout of the text file.

Example 1:
include std/error.e 
 
object loaded 
map AppOptions 
sequence SavedMap = "c:\\myapp\\options.txt" 
 
loaded = load_map(SavedMap) 
if equal(loaded, -1) then 
    crash("Map '%s' failed to open", SavedMap) 
end iF 
 
-- By now we know that it was loaded and a new map created, 
-- so we can assign it to a 'map' variable. 
AppOptions = loaded 
if get(AppOptions, "verbose", 1) = 3 then 
    ShowIntructions() 
end if 
See Also:

new, save_map

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu